<template>
  <Loading v-show="1" />
</template>

<script>
import config from "../config.js";
import Loading from "@/components/Loading.vue";

export default {
  name: "login",
  components: {
    Loading
  },
  mounted: function () {
    let code = localStorage["x-api-code"];
    if (code) {
      location.assign("/#/books");
    } else {
      code = this.$route.query.code;
      if (code) {
        localStorage["x-api-code"] = code;
        location.assign("/#/books");
      } else {
        // console.log("重定向到登录地址");
        location.assign(config.login.login_url);
      }
    }
  },
};
</script>